package euclid;

/**
 * Interface definition: Coordinator.
 * 
 * @author OpenORB Compiler
 */
public abstract class CoordinatorPOA extends org.omg.PortableServer.Servant
        implements CoordinatorOperations, org.omg.CORBA.portable.InvokeHandler
{
    public Coordinator _this()
    {
        return CoordinatorHelper.narrow(_this_object());
    }

    public Coordinator _this(org.omg.CORBA.ORB orb)
    {
        return CoordinatorHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:euclid/Coordinator:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("endCalculation")) {
                return _invoke_endCalculation(_is, handler);
        } else if (opName.equals("endSystem")) {
                return _invoke_endSystem(_is, handler);
        } else if (opName.equals("getStarterList")) {
                return _invoke_getStarterList(_is, handler);
        } else if (opName.equals("logClient")) {
                return _invoke_logClient(_is, handler);
        } else if (opName.equals("logMonitor")) {
                return _invoke_logMonitor(_is, handler);
        } else if (opName.equals("logProcess")) {
                return _invoke_logProcess(_is, handler);
        } else if (opName.equals("logStarter")) {
                return _invoke_logStarter(_is, handler);
        } else if (opName.equals("startGcdCalculation")) {
                return _invoke_startGcdCalculation(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_getStarterList(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;

        euclid.Starter[] _arg_result = getStarterList();

        _output = handler.createReply();
        euclid.starterListHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_startGcdCalculation(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();
        int arg1_in = _is.read_long();
        int arg2_in = _is.read_long();
        int arg3_in = _is.read_long();
        int arg4_in = _is.read_long();
        int arg5_in = _is.read_long();

        try
        {
            startGcdCalculation(arg0_in, arg1_in, arg2_in, arg3_in, arg4_in, arg5_in);

            _output = handler.createReply();

        }
        catch (euclid.CoordinatorPackage.exInvalidParameter _exception)
        {
            _output = handler.createExceptionReply();
            euclid.CoordinatorPackage.exInvalidParameterHelper.write(_output,_exception);
        }
        catch (euclid.CoordinatorPackage.exNoStarter _exception)
        {
            _output = handler.createExceptionReply();
            euclid.CoordinatorPackage.exNoStarterHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_endCalculation(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        int arg0_in = _is.read_long();

        endCalculation(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_logClient(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        euclid.Client arg0_in = euclid.ClientHelper.read(_is);

        logClient(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_logMonitor(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        monitor.Monitor arg0_in = euclid.MonitorHelper.read(_is);

        logMonitor(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_logStarter(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        euclid.Starter arg0_in = euclid.StarterHelper.read(_is);

        logStarter(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_logProcess(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = _is.read_string();
        int arg1_in = _is.read_long();

        logProcess(arg0_in, arg1_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_endSystem(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;

        endSystem();

        _output = handler.createReply();

        return _output;
    }

}
